package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.HRServicedtp;
import com.zr.serviceImpl.HRServiceImpldtp;

import net.sf.json.JSONObject;
//ygrz
public class GetAllControllerdtp extends HttpServlet{
	HRServicedtp hr=new HRServiceImpldtp();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		int page=Integer.parseInt(req.getParameter("page"));
		int rows=Integer.parseInt(req.getParameter("rows"));
		String name=req.getParameter("name");
		JSONObject json=hr.findAllData(page, rows,name);
		PrintWriter pw=resp.getWriter();
		pw.write(json.toString());
		pw.flush();
		pw.close();
	}
}
